package com.mypack.dao;

import javax.persistence.NoResultException;

import com.mypack.dao.helper.DaoSupport;
import com.mypack.domain.Config;

/**
 * 系统配置
 */
public class ConfigDao extends DaoSupport<Config> {
	private static ConfigDao dao = new ConfigDao();
	
	/**
	 * static factory
	 * get dao instance
	 */
	public static ConfigDao get() {
		return dao;
	}
	
	public Config getFirst() {
		try {
			return (Config) getEM().createQuery("select from Config").setMaxResults(1).getSingleResult();
		} catch (NoResultException e) {
			return null;
		}
	}
	
}
